package com.wx.wxapp.controller;

import com.wx.wxapp.service.CardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
@RestController
public class CardController {
    @Autowired
    private CardService cardService;
    /*
     *   功能：用户发布帖子
     *   参数：
     *       title：帖子标题
     *       information:帖子内容
     *       time:帖子时间
     *       label:帖子标签
     *       cardType:帖子类型
     *       openid:用户的openid
     * */
    @RequestMapping(value = "/publishCard",method = RequestMethod.POST)
    public String PublishCards(@RequestParam("title")String title, @RequestParam("information")String information,
                             @RequestParam("time")Date time, @RequestParam("label")String label,
                             @RequestParam("cardType")String cardType,@RequestParam("openid")String openid){
        String cardId = cardService.PublishCard(title,information,time,label,cardType,openid);
        return cardId;
    }
}
